/**
 * 作者: wgx
 * 日期: 2024-12-03 15:45:50
 * 备注: 用户物资争夺模块的伙伴上场数据
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.server.game.base.AllParam;
import com.motu.vertx.module.utility.toolset.TimeUtils;

public class UserSnatchPartner extends UserSnatchPartnerModel {
    public UserSnatchPartner() {
        super();
    }

    public void reset() {
        boolean isUpdate = false;
        if (!TimeUtils.isToday(getResetTime())) {
            putMatchFightNum(0);
            putMatchFightCdTime(0);
            putMatchFightRecoverNum(0);
            putChallengeNum(0);
            putResetTime(TimeUtils.getCurTime());
            isUpdate = true;
        }
        //  是否到了cd 时间,且可以恢复战斗次数
        if (getMatchFightCdTime() > 0 && TimeUtils.getTimeDiff(getMatchFightCdTime()) >= AllParam.SNATCH_MATCH_FIGHT_CD_TIME && getMatchFightRecoverNum() < AllParam.SNATCH_MATCH_FIGHT_RECOVER_NUM_MAX) {
            putMatchFightCdTime(0);
            putMatchFightNum(0);
            addMatchFightRecoverNum(1);
            isUpdate = true;
        }
        if (isUpdate) {
            update();
        }
    }
}
